package com.clouddms.dto;

import java.util.Set;

/**
 * 登录响应DTO
 */
public class LoginResponse {

    private boolean success;
    private String message;
    private String token;
    private String tokenType = "Bearer";
    private Long userId;
    private String username;
    private Set<String> roles;
    private Long expiresIn; // Token过期时间（秒）

    public LoginResponse() {}

    public LoginResponse(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public static LoginResponse success(String token, Long userId, String username, Set<String> roles, Long expiresIn) {
        LoginResponse response = new LoginResponse();
        response.success = true;
        response.message = "登录成功";
        response.token = token;
        response.userId = userId;
        response.username = username;
        response.roles = roles;
        response.expiresIn = expiresIn;
        return response;
    }

    public static LoginResponse failure(String message) {
        return new LoginResponse(false, message);
    }

    // Getters and Setters
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getTokenType() {
        return tokenType;
    }

    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Set<String> getRoles() {
        return roles;
    }

    public void setRoles(Set<String> roles) {
        this.roles = roles;
    }

    public Long getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(Long expiresIn) {
        this.expiresIn = expiresIn;
    }
}